﻿
<script>
    $(document).ready(function () {
        $("#tree").treeview({
            animated: "fast",
            collapsed: true,
        });
        $("#treeview a").click(function() {
            $("#treeview a").removeClass("tree-selected");
            $(this).addClass("tree-selected");
            var value = $(this).attr("val");
            $('#lblRelatedCat').html(value + " - " + this.innerHTML);
            $('#hdRelCat').val(value);
        });
        InitTableSelected();
    });
    
</script>
<style>
        .treeview p {margin-bottom: 0px !important;}
        .display {color: rgb(198, 198, 198);}
        .tree-selected {color: red;}
</style>

<div id="promotionWebsite" class="modal hide fade" data-width="700" tabindex="-1" role="dialog" aria-labelledby="addController" aria-hidden="true">
    <div class="container-fluid">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h5>Promotion Website</h5>
        </div>
        <div class="modal-body">
            <input type="hidden" id="promositeid" value="@ViewBag.Id"/>
            <div class="row-fluid">
                <div class="span3">Position</div>
                <div class="span4">
                    <input type="text" id="positionPromo" class="input-block-level" value="@ViewBag.Position" />
                </div>
            </div>
            <div class="row-fluid">
                <div class="span3">Website</div>
                <div class="span9">
                    @Html.DropDownList("StoreID", null, new { @class = "input-block-level", onchange = "changeCatTree(this.value)" })
                </div>
            </div>
            <div class="row-fluid">
                <div class="span3"></div>
                <div class="span9">
                    <ul class="tabs tabs-inline tabs-top orderdetail-task-tabs margin0">
                        <li class="active">
                            <a href="#treeview" data-toggle="tab">Tree view</a>
                        </li>
                        <li>
                            <a href="#listview" data-toggle="tab">List view</a>
                        </li>
                        @*<li>
                            <a href="#promotions" data-toggle="tab">Promotions</a>
                        </li>*@
                    </ul>

                    <div class="tab-content padding tab-content-inline tab-content-bottom orderdetail-task-tabs-content" style="height: 268px; overflow: auto;">
                        <div class="tab-pane active" id="treeview">
                            @Html.Raw(ViewBag.Tree)
                        </div>
                        <div class="tab-pane" id="listview">
                            <div class="row-fluid">
                                @Html.Raw(ViewBag.List)
                            </div>
                        </div>
                        @*<div class="tab-pane" id="promotions">
                            
                        </div>*@
                    </div>
                </div>
            </div>
        </div>

        <div class="modal-footer">
            <div class="row-fluid">
                <div class="span6">
                    <div class="span3">Related Category:</div>
                    <div class="span9">
                        <div class="span2"><a onclick=" $('#treeview a').removeClass('tree-selected');$('#lblRelatedCat').empty();$('#hdRelCat').val('');">Clear</a></div>
                        <div class="span10">
                            <label id="lblRelatedCat">@ViewBag.Cate</label>
                            <input type="hidden" id="hdRelCat" value="@ViewBag.CateId"/>
                        </div>
                    </div>
                </div>
                <div class="span6">
                    <button class="btn btn-primary w90" data-dismiss="modal" aria-hidden="true" onclick="savePromoWebsite()">OK</button>
                    <button class="btn w90" data-dismiss="modal" aria-hidden="true">Close</button>
                </div>
            </div>
        </div>
    </div>
</div>